<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<script type="text/javascript">
    function page(pageIndex) {
        location.href ="${pageContext.request.contextPath}/book/list?pageIndex=" + pageIndex;
    };
</script>
<body>
<form action="${pageContext.request.contextPath}book/list" method="post">
    <select name="chooseId">
        <option value="0">请选择</option>
        <option value="1">书名</option>
        <option value="2">作者</option>
        <option value="3">出版社</option>
    </select>
    <input type="text" name="choose" />

    <input type="submit" value="提交"/>
    <br/>
</form>
<tr >
    <td colspan="6" style="text-align:right"><a href='${pageContext.request.contextPath}/AddBook.jsp' style="color:red">增加图书</a></td>
    <!-- 资源绝对路径，jsp可一相对 ../test/..jsp -->
</tr><br/>
<table border="1">
    <tr>

        <td>标题</td>
        <td>内容摘要</td>
        <td>作者</td>
        <td>发布时间</td>
        <td>操作</td>
    </tr>


    <c:forEach var="item" items="${page.list}" varStatus="status">
        <tr <c:if test="${status.index %2==1}">style="background-color:rgb(123,123,123)"</c:if>
            <c:if test="${status.index %2==0}">style="background-color:rgb(255,255,255)"</c:if>>

            <td>${item.title}</td>
            <td>${item.summary}</td>
            <td>${item.author}</td>
            <td>${item.createdate}</td>
            <td>${item.bookPrice}</td>
            <td></td>
        </tr>
    </c:forEach>
</table>
<!-- 分页代码 -->
<a href="javascript:page(${1})">第一页</a>
<a href="javascript:page(${page.currPageNo-1})">上一页</a>
<a href="javascript:page(${page.currPageNo+1})">下一页</a>
<a href="javascript:page(${page.totalPageCount})">末页</a>
当前是第${page.currPageNo}页,共${page.totalPageCount}页，共${page.totalCount}条

</body>
</html>
